// pages/profile/profile.js
import { backimageReq } from '@/miniprogram/utils/API/imageManage'
import Notify from '@vant/weapp/notify/notify';
import { decode } from '@/miniprogram/utils/security/security'
import { getstorage } from '@/miniprogram/utils/storage'
import {userStore} from '@/stores/userStore.js'
import {createStoreBindings,storeBindingsBehavior} from 'mobx-miniprogram-bindings'
import {userBehavior} from '@/miniprogram/utils/behaviors/userBehavior'
const gloub = getApp()
Component({
   behaviors:[userBehavior],
   /**
    * 页面的初始数据
    */
   data: {
      opList: [
         { id: 1, iconUrl: '/static/icons/待付款.png', title: '待付款', url: '/miniprogram/pre_loadModules/orderModule/pages/orderList/orderList', enableCount: true, count: 0 },
         { id: 2, iconUrl: '/static/icons/待发货.png', title: '待发货', url: '/miniprogram/pre_loadModules/orderModule/pages/orderList/orderList', enableCount: true, count: 0 },
         { id: 3, iconUrl: '/static/icons/待收货.png', title: '待收货', url: '/miniprogram/pre_loadModules/orderModule/pages/orderList/orderList', enableCount: true, count: 0 },
         { id: 4, iconUrl: '/static/icons/已完成.png', title: '已完成', url: '/miniprogram/pre_loadModules/orderModule/pages/orderList/orderList', enableCount: true, count: 0 },
         { id: 5, iconUrl: '/static/icons/全部.png', title: '全部/售后', url: '/miniprogram/pre_loadModules/orderModule/pages/orderList/orderList', enableCount: true, count: 0 },
      ],
      opList2: [
         { id: 1, iconUrl: '/static/icons/定位.png', title: '收货地址', url: '/miniprogram/pre_loadModules/addressModule/pages/address/address', openType: '', enableCount: false, count: 0 },
         { id: 2, iconUrl: '/static/icons/实名认证.png', title: '实名认证', url: '/pages/verified/verified', openType: 0, enableCount: false, count: 0 },
         { id: 3, iconUrl: '/static/icons/联系客服.png', title: '联系客服', url: '/contactUsModule/pages/index', openType: 'contact', enableCount: false, count: 0 },
         { id: 4, iconUrl: '/static/icons/证件管理.png', title: '证件管理', url: '/pages/certificateManagement/certificateManagement', openType: '', enableCount: false, count: 0 },
         { id: 5, iconUrl: '/static/icons/设置.png', title: '设置中心', url: '/miniprogram/pre_loadModules/settingModule/pages/setting/setting', openType: '', enableCount: false, count: 0 },

      ],
      backImgList: []
   },

   methods:{
      onLoad(options) {
         let { opList ,userInfo} = this.data
         for (let i = 0; i < gloub.globalData.orderCount.length; i++) {
            opList[i].count = gloub.globalData.orderCount[i].count;
         }
      },
      loginclick() {
         wx.navigateTo({
            url: '/pages/login/login',
         })
      },
      onShow(){
         this.getBackImgUrl()
         this.updateUserInfo()
      },
   
      onUnload(){
         
      },
      async getBackImgUrl() {
         let res = await backimageReq()
         if (res.data.code === 200) {
            this.setData({
               backImgList: res.data.data
            })
         }
      }
   
   }

})